﻿<%@ Page Language="VB" AutoEventWireup="false" CodeFile="default.aspx.vb" Inherits="MyDesktopCms" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="desktop" runat="server">
<%  
       
    If Session("accessLevel") <> "admin" Then
        If Session("accessLevel") <> "user" Then Session("accessLevel") = "guest"
    End If
    
    Session("wallPaper") = "images/wallpapers/0.jpg"
    
    If Session("accessLevel") = "guest" Then
        Session("wallPaper") = "images/wallpapers/0.jpg"
    End If
       
 %>

<title>Web-Systems Version 1.00</title>

<link rel="stylesheet" type="text/css" href="stylesheets/main.css" />
<link rel="stylesheet" type="text/css" href="stylesheets/window.css" />
<link rel="stylesheet" type="text/css"href="stylesheets/menu.css" />

<script type="text/javascript" src="javascript/jquery/jq-core.js" ></script>
<script type="text/javascript" src="javascript/jquery/jq-menu.js"></script>
<script type="text/javascript" src="javascript/jquery/jq-drag.js"></script>
<script type="text/javascript" src="javascript/jquery/jq-prompt.js"></script>

</head>

<body onload="initialize('<%=Session("accessLevel")%>')"> 

<div id="background">
 <img src="<%=Session("wallPaper")%>" alt="" onmousedown="return false;" id="wallpaper" />
</div>

<div id="content">

<%
   
    Dim iconName, iconFile, iconImage, iconLevel, iconPadding, iconPointer, iconDisplay, iconIndent As String
    
    Dim file As String = "xml_icons.xml"
         
    Dim xml = Server.CreateObject("Microsoft.XMLDOM")
    xml.async = False
    xml.load(Server.MapPath(file))
    
    Dim counter = xml.documentElement.childNodes.length
    
  
%>

<div id="taskbar">
<div class="fixed">
   <table class="taskbar" cellspacing="0" cellpadding="0" width="100%" border="0">           
      <tr>
          <td onclick="startmenu()" id="start-image"><img src="images/menu/start.png" alt="Starts" /></td>
          <td onclick="startmenu()" id="start-texts"><b>Start</b></td>
          <td class="separator"><img src="images/menu/taskbar.png" alt="" /></td>
               
          <td onclick="clear()"><img src="images/menu/wall.png" alt="Desktop" /></td>
          <td onclick="clear()">Desktop</td>
               
          <td onclick=""><img src="images/menu/kalk.png" alt="Spēles" /></td>
          <td onclick="">Spēle</td>
                     
          <td valign="middle" align="left" class="taskarea">          
                
<%   
    For i = 0 To (counter - 1)
        
        iconName = xml.documentElement.childNodes(i).attributes.getNamedItem("name").nodeValue
        iconPointer = i
        
%>                                        
        <div class="minimized" id="task(<%=iconPointer%>)" onclick="restore(<%=iconPointer%>)"><%=iconName%></div> 
                
<%  
Next
%>   
        </td>   
                                      
        <td class="separator"><img src="images/menu/taskbar.png" alt="" /></td>                
        <td valign="middle"><span id="time" class="clocks"></span></td>   
                   
      </tr>          
    </table>   
</div>
</div>

     
<div id="icons">
<%  
    
    For i = 0 To (counter - 1)
        
        iconLevel = xml.documentElement.childNodes(i).attributes.getNamedItem("level").nodeValue
        
        iconDisplay = "block"
        
        iconName = xml.documentElement.childNodes(i).attributes.getNamedItem("name").nodeValue
        iconImage = xml.documentElement.childNodes(i).attributes.getNamedItem("image").nodeValue
        
        
        iconPadding = i - 2 & "00px"
        iconPointer = i
        iconIndent = "0px"
       
        If i > 7 Then
            iconIndent = "100px"
            iconPadding = (i - 7) * 100 & "px"
        End If
        
        
        If iconLevel = "system" Then iconDisplay = "none"
                               
%>
        <div id="icon(<%=iconPointer%>)" style="display:<%=iconDisplay%>">
            <div class="absolute" style="padding-top:<%=iconPadding%>; padding-left:<%=iconIndent%>">
            <div class="icon" ondblclick="openWindow(<%=iconPointer%>)">        
                <img id="iconImage(<%=iconPointer%>)" src="<%=iconImage%>" alt="<%=iconName%>" />
                <div id="iconTitle(<%=iconPointer%>)"><%=iconName%></div>
              </div>    
            </div>
           </div>

<%  Next  %>
 
</div>

<div id="windows">
            
   <% For i = 0 To (counter - 1)
        
    iconName = xml.documentElement.childNodes(i).attributes.getNamedItem("name").nodeValue
    iconFile = xml.documentElement.childNodes(i).attributes.getNamedItem("file").nodeValue
  
           Dim windowWidth As String = "645px"
           Dim windowHeight As String = "420px"
    
           iconPadding = "190px"
           iconPointer = i
           
                        
%>
     
       <div id="window(<%=iconPointer%>)" class="window"> 
        <div class="absolute" style="padding:<%=iconPadding%>;">
        <table width="<%=windowWidth%>" cellpadding="0" cellspacing="0">
        <tr>
            <td class="thumb"/>
            <td class="title"><div class="header" id="windowName(<%=iconPointer%>)"><%=iconName%></div></td>
            
            <td class="minimize" onclick="minimize(<%=iconPointer%>)"/>
            <td class="maximize" onclick="maximize(<%=iconPointer%>)"/>
            <td class="obturate" onclick="obturate(<%=iconPointer%>)"/>
            
        </tr>
        </table>
           
        <table width="<%=windowWidth%>" cellpadding="0" cellspacing="0" style="height:<%=windowHeight%>;">
            <tr>
                <td class="left"/>
                <td class="content" valign="top"><iframe src="<%=iconFile%>" scrolling="auto" id="frame(<%=iconPointer%>)"></iframe></td>
                <td class="right"/>
            </tr>
        </table>
        
        <table width="<%=windowWidth%>" cellpadding="0" cellspacing="0">
            <tr>
                <td class="bottom"/>
                <td class="status">&nbsp;</td>
                <td class="resize" onclick="doresize(<%=iconPointer%>);" />
            </tr>
        </table>
       </div>
    </div> 

<%  
     
Next
xml = Nothing
 
%>

</div>
</div>
		   
		   
              
<div class="startmenu" id="startmenu" onmouseout="delayclose()">
    <ul class="mainlevel-nav"   onmouseover="canceldelay();" >
    <li><a class="mainlevel-nav" href="">Mans Dators</a></li>
    <li><a class="mainlevel-nav" onclick="loginUser()">Ielogoties</a></li>
    <li><a class="mainlevel-nav" href="">Kalkulators</a></li>
    <li><a class="mainlevel-nav" href="">Tapetes</a></li>
    <li><a class="mainlevel-nav" onclick="shutDown()">Iziet</a></li>
    </ul>   
 </div>

		    
<ul id="iconMenu" class="contextMenu">
    <li class="open"><a href="#open"><b>Atvērt</b></a></li>
    
    <li class="edit separator"><a href="#changeicon">Mainīt Ikonu</a></li>
    <li class="edit "><a href="#changename">Mainīt Nosaukumu</a></li>
    <li class="edit "><a href="#changeaccess">Mainīt Pieeju</a></li>
    <li class="paste separator"><a href="#copy">Kopēt</a></li>
    <li class="delete "><a href="#delete">Dzēst</a></li>
    <li class="copy separator"><a href="#asign">Norāde Uz Datni</a></li>
</ul>   


<ul id="defaultMenu" class="contextMenu">

    <li class="open"><a href="#file">Jauna Datne</a></li>
    <li class="open"><a href="#icon">Jauna Ikona</a></li>
    <li class="open"><a href="#user">Jauns Lietotājs</a></li>
    <li class="login separator"><a href="#login">Ielogoties</a></li>
    <li class="edit"><a href="#wall">Mainīt Fonu</a></li>
    <li class="refresh separator"><a href="#reloads">Pārladēt Statusu</a></li>
    <li class="refresh "><a href="#refresh">Saglabāt Statusu</a></li>
    
    
</ul>   

<div id="includes">

<script type="text/javascript" src="javascript/ajax-simple.js"></script>
<script type="text/javascript" src="javascript/core-simple.js"></script>
<script type="text/javascript" src="javascript/drop-simple.js"></script>

<input  id="count" type="hidden" value="<%=counter%>" />
<iframe id="systray" src=""></iframe>

</div>

</body>
</html>